package pers.lmd.convert;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import pers.lmd.domain.dto.TeacherDTO;
import pers.lmd.domain.entity.Teacher;

/**
 * @Author lmd
 * @Date 2023/5/1 4:30
 */
@Mapper
public interface TeacherConvert {
    TeacherConvert INSTANCES = Mappers.getMapper(TeacherConvert.class);
    @Mappings({
            @Mapping(source = "name", target = "name"),
            @Mapping(source = "age", target = "age"),
            @Mapping(source = "sex", target = "sex"),
            @Mapping(source = "phone", target = "phone"),
            @Mapping(source = "email", target = "email"),
            @Mapping(target = "id", ignore = true)
    })
    Teacher toTeacher(TeacherDTO teacherDTO);
}
